package com.company;

import java.util.Scanner;

import org.junit.Test;

public class ţţ�ҹ��� {
	
	
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();//����������
		int M = scanner.nextInt();//С�������
		
		int[][] work = new int[N][2];
		int[] Ai = new int[M];
		
		for (int i = 0; i < N; i++) {
			work[i][0] = scanner.nextInt();
			work[i][1] = scanner.nextInt();
		}
		for (int i = 0; i < M; i++) {
			Ai[i] = scanner.nextInt();
		}
		for (int i = 0; i < M; i++) {
			int PI = 0;
			for(int j = 0; j < N; j++) {
				if(Ai[i] >= work[j][0] && PI < work[j][1])
					PI = work[j][1];
			}
			Ai[i] = PI;
		}
		for (int i = 0; i < Ai.length; i++) {
			System.out.println(Ai[i]);
		}
		
		
	}
}
